import { createRouter, createWebHistory } from 'vue-router'
import IndexView from '../views/IndexView.vue'
import Index1View from '../views/Index1View.vue'
import Index2View from '../views/Index2View.vue'
import ZhinshView from '../views/ZhinshView.vue'
import Zhinsh1View from '../views/Zhinsh1View.vue'
import FuwuView from '../views/FuwuView.vue'
import Fuwu2View from '../views/Fuwu2View.vue'
import GuanyuView from '../views/GuanyuView.vue'
import Guanyu2View from '../views/Guanyu2View.vue'
import LianxiView from '../views/LianxiView.vue'
import Lianxi2View from '../views/Lianxi2View.vue'
import XinweiView from '../views/XinweiView.vue'
import Xinwei2View from '../views/Xinwei2View.vue'
import ParticularsView from '../views/ParticularsView.vue'
import SmartwatchView from '../views/SmartwatchView.vue'
import AlldocumentsView from '../views/AlldocumentsView.vue'
import AlldocumentsView2 from '../views/AlldocumentsView2.vue'
import ParticularsView2 from '../views/ParticularsView2.vue'
import SmartwatchView2 from '../views/SmartwatchView2.vue'
import ChakanView from '../views/ChakanView.vue'
import Chakan2View from '../views/Chakan2View.vue'

const routes = [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    name: 'index',
    component: IndexView,
    children: [
      { path: '/index', redirect: '/index/index1' },
      { path: '/index/index1', component: Index1View },
      { path: '/index/index2', component: Index2View },
      { path: '/index/zhinsh', component: ZhinshView },
      { path: '/index/zhinsh1', component: Zhinsh1View },
      { path: '/index/fuwu', component: FuwuView },
      { path: '/index/fuwu2', component: Fuwu2View },
      { path: '/index/guanyu', component: GuanyuView },
      { path: '/index/guanyu2', component: Guanyu2View },
      { path: '/index/lianxi', component: LianxiView },
      { path: '/index/lianxi2', component: Lianxi2View },
      { path: '/index/xinwei', component: XinweiView },
      { path: '/index/xinwei2', component: Xinwei2View },
      { path: '/index/smartwatch', component: SmartwatchView },
      { path: '/index/particulars', component: ParticularsView },
      { path: '/index/particulars2', component: ParticularsView2 },
      { path: '/index/smartwatch2', component: SmartwatchView2 },
      { path: '/index/alldocuments', component: AlldocumentsView },
      { path: '/index/alldocuments2', component: AlldocumentsView2 },
      { path: '/index/chaka', component: ChakanView },
      { path: '/index/chaka2', component: Chakan2View }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})
// router.beforeEach((to, from, next) => {
//   if (localStorage.getItem('flag') === 1) {
//     next('/index/index1')
//   } else {
//     next('/index/index2')
//   }
// })
export default router
